#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <stack>
#include <map>
#include <iostream>
#include <functional>

using namespace std;

class Solution {
public:
    int evalRPN(vector<string>& tokens) {
        stack<int> st;
        map<string, function<int(int, int)>> max =
        {
            {"+", [](int x,int y) {return x + y;}},
            {"-" , [](int x,int y) {return x - y;}},
            {"*" , [](int x,int y) {return x * y;}},
            {"/" , [](int x,int y) {return x / y;}}
        };

        for (int i = 0; i < tokens.size(); ++i)
        {
            if (max.count(tokens[i]))
            {
                int x = st.top();
                st.pop();
                int y = st.top();
                st.pop();
                st.push(max[tokens[i]](y, x));
            }
            else
            {
                st.push(stoi(tokens[i]));
            }
        }

        return st.top();
    }
};

int main()
{
    return 0;
}